
const int analogInPin = A0;
const int analogOutPin = 9;
int potentiometer =0;
int output = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  potentiometer = analogRead(analogInPin);

  output = map(potentiometer,0,1023,0,255);

  analogWrite(analogOutPin,output);

  delay(2);
}
